<template>
  <div>
    分析页
    <div class="box-pie" style="height: 400px" ref="chart"></div>
  </div>
</template>

<script>
export default {
  name: 'AnalysisPage',
  data() {
    return {
      chart: null,
      // 配置可视化图形
      option: {
        title: {
          text: 'Referer of a Website',
          subtext: 'Fake Data',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 108, name: 'Search Engine' },
              { value: 32, name: 'Direct' },
              { value: 22, name: 'Email' },
              { value: 11, name: 'Union Ads' },
              { value: 56, name: 'Video Ads' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    };
  },
  mounted() {
    this.getPage();
  },
  methods: {
    getPage() {
      // 引用chart并初始化
      this.chart = this.$echarts.init(this.$refs.chart);
      // 使用刚指定的配置项和数据显示图表。
      this.chart.setOption(this.option);
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
